package com.ruoyi.project.demo.controller;

import com.alibaba.fastjson.JSON;
import com.ruoyi.project.mgr.course.domain.MgrCourse;
import com.ruoyi.project.mgr.course.service.IMgrCourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

/**
 * 图标相关
 * 
 * @author ruoyi
 */
@Controller
@RequestMapping("/demo/icon")
public class DemoIconController
{
    private String prefix = "demo/icon";

    /**
     * FontAwesome图标
     */
    @GetMapping("/fontawesome")
    public String fontAwesome()
    {
        return prefix + "/fontawesome";
    }

    /**
     * Glyphicons图标
     */
    @GetMapping("/glyphicons")
    public String glyphicons()
    {
        return prefix + "/glyphicons";
    }

    /**
     * Glyphicons图标
     */
    @GetMapping("/echarts")
    public String echarts(ModelMap modelMap)
    {
        List<String> list = new ArrayList<>();
        list.add("2017-08-01");
        list.add("初一");
        List<List> mapList = new ArrayList<>();
        mapList.add(list);
//        List<Map<String, String>> mapList = new ArrayList<>();
//        Map<String,String> map = new HashMap<>();
//        map.put("riqi", "2017-8-1");
//        map.put("nongli", "初一");
//        Map<String,String> map1 = new HashMap<>();
//        map1.put("riqi", "2017-8-2");
//        map1.put("nongli", "初2");
//        mapList.add(map);
//        mapList.add(map1);
        modelMap.put("data", JSON.toJSONString(mapList));
        return prefix + "/echarts";
    }
    @Autowired
    private IMgrCourseService courseService;

    @GetMapping("/timeline")
    public String timeline(ModelMap modelMap)
    {
        modelMap.put("courses", courseService.selectMgrCourseList(new MgrCourse()));
        return prefix + "/timeline";
    }
}
